<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>PintarOS: include/state.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">PintarOS
   </div>
   <div id="projectbrief">Operating System for Smart Card</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">state.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Main header file, contain all global definition, data structure, and function.  
<a href="#details">More...</a></p>

<p><a href="state_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structstate__struct.html">state_struct</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">structure of Card State Manager  <a href="structstate__struct.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a35937514c20ebac19d6598f04416db7e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a35937514c20ebac19d6598f04416db7e"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>STATE_OK</b>&#160;&#160;&#160;0</td></tr>
<tr class="separator:a35937514c20ebac19d6598f04416db7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7bf0c086c7c41c12cc63324327932d91"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7bf0c086c7c41c12cc63324327932d91"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>STATE_ERROR</b>&#160;&#160;&#160;1</td></tr>
<tr class="separator:a7bf0c086c7c41c12cc63324327932d91"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad695a7f75df6ff2c4f1d5a630a93e7c5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad695a7f75df6ff2c4f1d5a630a93e7c5"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>STATE_WRONG</b>&#160;&#160;&#160;2</td></tr>
<tr class="separator:ad695a7f75df6ff2c4f1d5a630a93e7c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a34781bb4f876dfe1b80bc460ab33e31b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a34781bb4f876dfe1b80bc460ab33e31b"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>STATE_BLOCKED</b>&#160;&#160;&#160;3</td></tr>
<tr class="separator:a34781bb4f876dfe1b80bc460ab33e31b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ae101467a47dda550dcef26f05b434481"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="state_8h.html#ae101467a47dda550dcef26f05b434481">State_Init</a> ()</td></tr>
<tr class="memdesc:ae101467a47dda550dcef26f05b434481"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize State Manager.  <a href="#ae101467a47dda550dcef26f05b434481">More...</a><br/></td></tr>
<tr class="separator:ae101467a47dda550dcef26f05b434481"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a41c8092995bb8b188084202beb1e0b0e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="state_8h.html#a41c8092995bb8b188084202beb1e0b0e">State_ChangeState</a> (int newState)</td></tr>
<tr class="memdesc:a41c8092995bb8b188084202beb1e0b0e"><td class="mdescLeft">&#160;</td><td class="mdescRight">verify security state with PIN  <a href="#a41c8092995bb8b188084202beb1e0b0e">More...</a><br/></td></tr>
<tr class="separator:a41c8092995bb8b188084202beb1e0b0e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4ca0a5601d8d5ea16c22289dc3d87222"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="state_8h.html#a4ca0a5601d8d5ea16c22289dc3d87222">State_Verify</a> (uint8_t *PIN)</td></tr>
<tr class="memdesc:a4ca0a5601d8d5ea16c22289dc3d87222"><td class="mdescLeft">&#160;</td><td class="mdescRight">verify security state with PIN  <a href="#a4ca0a5601d8d5ea16c22289dc3d87222">More...</a><br/></td></tr>
<tr class="separator:a4ca0a5601d8d5ea16c22289dc3d87222"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a299905ff510951310f14b10bc35c1ee3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a299905ff510951310f14b10bc35c1ee3"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>State_GetChallenge</b> (uint8_t *buffer)</td></tr>
<tr class="separator:a299905ff510951310f14b10bc35c1ee3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0dac935fe070faf2365d6061a72279d4"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="state_8h.html#a0dac935fe070faf2365d6061a72279d4">State_VerifyAuth</a> (uint8_t *encrypted)</td></tr>
<tr class="memdesc:a0dac935fe070faf2365d6061a72279d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">verify security state with External Authenticate  <a href="#a0dac935fe070faf2365d6061a72279d4">More...</a><br/></td></tr>
<tr class="separator:a0dac935fe070faf2365d6061a72279d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abdcb1cbd0922476b3d7f882d04cbe345"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="state_8h.html#abdcb1cbd0922476b3d7f882d04cbe345">State_SetCurrent</a> (uint16_t newfile)</td></tr>
<tr class="memdesc:abdcb1cbd0922476b3d7f882d04cbe345"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set current file.  <a href="#abdcb1cbd0922476b3d7f882d04cbe345">More...</a><br/></td></tr>
<tr class="separator:abdcb1cbd0922476b3d7f882d04cbe345"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a929190b9305f805a80adcf4854455572"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="state_8h.html#a929190b9305f805a80adcf4854455572">State_SetCurrentKey</a> (uint16_t newKey)</td></tr>
<tr class="memdesc:a929190b9305f805a80adcf4854455572"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set current EFKey.  <a href="#a929190b9305f805a80adcf4854455572">More...</a><br/></td></tr>
<tr class="separator:a929190b9305f805a80adcf4854455572"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaa85d3ce76908f6b6717f8f97acda925"><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="state_8h.html#aaa85d3ce76908f6b6717f8f97acda925">State_GetCurrent</a> ()</td></tr>
<tr class="memdesc:aaa85d3ce76908f6b6717f8f97acda925"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get current file.  <a href="#aaa85d3ce76908f6b6717f8f97acda925">More...</a><br/></td></tr>
<tr class="separator:aaa85d3ce76908f6b6717f8f97acda925"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afd31c5608e2aababd8efff1f170c1b2e"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="state_8h.html#afd31c5608e2aababd8efff1f170c1b2e">State_GetCurrentSecurity</a> ()</td></tr>
<tr class="memdesc:afd31c5608e2aababd8efff1f170c1b2e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get current security state.  <a href="#afd31c5608e2aababd8efff1f170c1b2e">More...</a><br/></td></tr>
<tr class="separator:afd31c5608e2aababd8efff1f170c1b2e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a90c042f2a0e18f28efd80da4f488e60e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="state_8h.html#a90c042f2a0e18f28efd80da4f488e60e">State_GetCurrentChallenge</a> (uint8_t *buffer)</td></tr>
<tr class="memdesc:a90c042f2a0e18f28efd80da4f488e60e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get current challenge.  <a href="#a90c042f2a0e18f28efd80da4f488e60e">More...</a><br/></td></tr>
<tr class="separator:a90c042f2a0e18f28efd80da4f488e60e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Main header file, contain all global definition, data structure, and function. </p>
<dl class="section author"><dt>Author</dt><dd>Ricky Hariady (<a href="#" onclick="location.href='mai'+'lto:'+'ric'+'ky'+'.ha'+'ri'+'ady'+'@e'+'nte'+'r.'+'web'+'.i'+'d'; return false;">ricky<span style="display: none;">.nosp@m.</span>.har<span style="display: none;">.nosp@m.</span>iady@<span style="display: none;">.nosp@m.</span>ente<span style="display: none;">.nosp@m.</span>r.web<span style="display: none;">.nosp@m.</span>.id</a>)</dd></dl>
<dl class="section date"><dt>Date</dt><dd>7/10/2013 </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a41c8092995bb8b188084202beb1e0b0e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int State_ChangeState </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>newState</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>verify security state with PIN </p>
<p>Verify security state using PIN</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">newState</td><td>the number of state to be activated </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Result </dd></dl>

</div>
</div>
<a class="anchor" id="aaa85d3ce76908f6b6717f8f97acda925"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t State_GetCurrent </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get current file. </p>
<p>Get index of current selected file</p>
<dl class="section return"><dt>Returns</dt><dd>current DF index </dd></dl>

</div>
</div>
<a class="anchor" id="a90c042f2a0e18f28efd80da4f488e60e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void State_GetCurrentChallenge </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get current challenge. </p>
<p>Get current challenge</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>address to save challenge </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="afd31c5608e2aababd8efff1f170c1b2e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t State_GetCurrentSecurity </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get current security state. </p>
<p>Get current security state</p>
<dl class="section return"><dt>Returns</dt><dd>current security state </dd></dl>

</div>
</div>
<a class="anchor" id="ae101467a47dda550dcef26f05b434481"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int State_Init </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize State Manager. </p>
<dl class="section return"><dt>Returns</dt><dd>Result<br/>
 Success = STATE_OK<br/>
 Not Success = STATE_ERROR </dd></dl>

</div>
</div>
<a class="anchor" id="abdcb1cbd0922476b3d7f882d04cbe345"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int State_SetCurrent </td>
          <td>(</td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>newfile</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set current file. </p>
<p>Set state of current file to a new file</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">newDF</td><td>index of current DF in file table </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Result </dd></dl>

</div>
</div>
<a class="anchor" id="a929190b9305f805a80adcf4854455572"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int State_SetCurrentKey </td>
          <td>(</td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>newKey</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set current EFKey. </p>
<p>Set state of current EFKey to a new EFKey</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">newEFKey</td><td>index of current EFKey in file table </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Result </dd></dl>

</div>
</div>
<a class="anchor" id="a4ca0a5601d8d5ea16c22289dc3d87222"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int State_Verify </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>PIN</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>verify security state with PIN </p>
<p>Verify security state using PIN</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">PIN</td><td>PIN Number </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Result </dd></dl>

</div>
</div>
<a class="anchor" id="a0dac935fe070faf2365d6061a72279d4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t State_VerifyAuth </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>encrypted</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>verify security state with External Authenticate </p>
<p>Verify terminal identity</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">encrypted</td><td>encrypted challenge from terminal </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Result </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Jun 4 2014 18:13:31 for PintarOS by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
